package cn.lcsjsxy.yxc.exercise.java050519;

public class ArrayExerciseThree {
    public static void demo() {
        int a;
        int[] ran = new int[10];
        for (int i = 0; i < ran.length; ) {
            a = 1 + (int) (Math.random() * 100);
            if (a % 2 == 0) {
                ran[i]=a;
                i++;
            }
        }

        for (int i=0;i<ran.length-1;i++){
            for (int j=0;j<ran.length-1-i;j++){
                if (ran[j]>ran[j+1]){
                    int temp=ran[j];
                    ran[j]=ran[j+1];
                    ran[j+1]=temp;
                }
            }
        }

        for (int i=0;i< ran.length;i++){
            System.out.println(ran[i]);
        }
    }
}
